#ifndef _COMPLEX_H_
#define _COMPLEX_H_

#include <iostream>
using namespace std;

template<typename T>
class Complex;

// 声明模板函数
template<typename T>
ostream& operator<<(ostream &out, const Complex<T> &obj);

template<typename T>
Complex<T> mySub(Complex<T> &a, Complex<T> &b);

template<typename T>
class Complex
{
   // 声明模板函数为友元，注意这里不使用<T>，因为它们已经是模板的一部分了
    friend ostream& operator<< <>(ostream &out, const Complex<T> &obj);
    friend Complex<T> mySub<T>(Complex <T> &a, Complex<T> &b);

public:
    Complex();
    Complex(T a, T b);
    Complex operator+(Complex &obj);
    
private:
    T a;
    T b;
};

#endif

